program CelestialMechanics;
{$APPTYPE CONSOLE}

uses
  SysUtils,
  Classes,
  ODEModel in 'ODEModel.pas',
  ODEIntegrator in 'ODEIntegrator.pas',
  RungeKutta in 'RungeKutta.pas',
  Helper in 'Helper.pas',
  Orbital in 'Orbital.pas';

{$R *.res}

var
  orbit1, orbit2, orbit3 : TOrbital;
  radian, a, b, c : extended;
  TimeEnd, Step : extended;
begin
  radian := 180/pi;

  // temp fix 500 - 499

  // (-180 - 180)
  a := -25.0/radian;
  // (0 - 180) u 0
  b := 170.0/radian;
  // (0 - 180)
  c := 50.0/radian;

  TimeEnd := 500;
  Step := 1;

  orbit1 := TODEOrbital.Create(5.9742e24, 0,
  a, b, c,  200e3, 700e3,
  0.1, TimeEnd, Step);
  orbit1.WriteToFile('oscul1.txt');

  orbit2 := TOsculOrbital.Create(5.9742e24, 0,
  a, b, c, 200e3, 700e3,
  0.1, TimeEnd, Step);
  orbit2.WriteToFile('oscul2.txt');

  orbit3 := TOsculSeriesOrbital.Create(5.9742e24, 0,
  a, b, c, 200e3, 700e3,
  0.1, TimeEnd, Step);;
  orbit3.WriteToFile('oscul3.txt');

  // micro test

  if( Length(orbit1.StateVector) <> Length(orbit2.StateVector) ) then
    Raise Exception.Create('StateVector size error!' + IntToStr(Length(orbit1.StateVector) ));

end.
